ChatGPT - Benchmark - Evaluation of Visual Basic support of ChatGPT, to solve Debug.Print issue

This document describes an actual conversation with the program "ChatGPT" as of 9 December 2023.
To use ChatGPT select: https://openai.com/blog/chatgpt/

Contents

Reflection

Notification: If part of this document is used by external parties, like ChatGPT, the url of this document has to be mentioned.

Introduction

The discussion consists of a series of Questions, Answers and Comments. Both parties in the discussion are treated as equals.

6. Evaluation of Visual Basic support to solve Debug.Print issue by ChatGPT and by Microsoft

1. I want to write a computer program

That's great! Writing a computer program can be a rewarding and enjoyable experience. To get started, you'll need to consider a few things:
  1. Choose a Programming Language: Depending on your goals and the type of application you want to build, you might choose a language like Python, JavaScript, Java, C++, or others.
  2. Define the Purpose of Your Program: Clearly understand what you want your program to achieve. This will help you plan your code and structure your program effectively.
    See also "Document Your Code"
  3. Set Up Your Development Environment: Install the necessary tools and software to write and run your code. This might include a code editor (like Visual Studio Code, Atom, or Sublime Text) and a compiler or interpreter for your chosen programming language.
  4. Learn the Basics: If you're new to programming, start by learning the basics of your chosen programming language. Understand variables, data types, control structures (if statements, loops), functions, and basic syntax.
  5. Break Down the Problem: Divide your program into smaller, manageable tasks. This makes it easier to tackle and solve problems one step at a time.
  6. Write Your Code: Begin coding based on the tasks you've identified. Start small, test your code frequently, and gradually build up the complexity.
  7. Test Your Code: Regularly test your code to catch and fix bugs early in the development process. Testing helps ensure that your program behaves as expected.
  8. Document Your Code: Add comments and documentation to explain your code. This is important for you and others who might read or collaborate on your code in the future.
    The most important of every software project, specific if you write it for a client, is detailed documentation, including an operation manual, a description of the mathematics and logic behind the program, a description of the input and of the output.
    All of that has to read and commented by the client before the project can start.
    If you write for your self, still a certain amount of documantation is required, if you want to modify your program later on.
  9. Iterate and Improve: Don't be afraid to iterate on your code. Refactor and improve your program based on your learning and feedback. If you write for a client, such a way of working can be very expensive for a client.
  10. Seek Help and Resources:
If you encounter challenges, don't hesitate to seek help. There are plenty of online communities, forums, and documentation resources available. Remember, the most important thing is to start coding and learn by doing. Whether you're building a simple script or a complex application, each project you work on will contribute to your programming skills. Good luck! If you have specific questions or need assistance with a particular programming language, feel free to ask.

So far so good. But the above information is too general. The problem is, I wanted to test to what extend ChatGPT is able to (help me to) write a program in Visual Basic. That is why I wrote the following:

2 I'm using Visual Basic

Great choice! Visual Basic (VB) is a user-friendly and versatile programming language, especially for developing Windows applications. Here's a basic guide to help you get started with programming in Visual Basic:
  1. Set Up Your Environment: Make sure you have Visual Studio installed. You can download the Community edition for free from the official Microsoft website.
  2. Create a New Project: Open Visual Studio, and create a new project. Choose a Windows Forms App if you're building a desktop application.
  3. Understand the Visual Studio Interface: Familiarize yourself with the Visual Studio interface. You'll have a form designer where you can design your user interface visually, and a code editor where you'll write the code.
  4. Design Your User Interface: Use the form designer to add buttons, textboxes, labels, and other controls to create the user interface of your application. You can set properties for these controls through the Properties window.
  5. Write Code in the Code-Behind: Double-click on a control to generate an event handler for it. This takes you to the code-behind file where you can write the corresponding VB code. For example, if you double-click a button, you'll be taken to the click event handler for that button.
  6. Learn Basic VB Syntax: Understand basic VB syntax, such as variable declarations, control structures (If statements, loops), and subroutine/function definitions. Visual Basic is designed to be relatively easy to read and write.
  7. Use Debugging Tools: Learn how to use the debugging tools in Visual Studio. You can set breakpoints, step through your code, and inspect variables to find and fix issues.
  8. Explore the Documentation: Microsoft provides extensive documentation for Visual Basic. If you're unsure about a function or how to use a particular feature, refer to the official documentation.
  9. Join a Community: Consider joining a VB or Visual Studio community. Forums and online communities can be valuable resources for getting help, sharing knowledge, and learning from others.
  10. Build and Test Your Application:
Regularly build and test your application. Make sure it behaves as expected and fix any bugs or issues that arise. Remember, the more you practice and build projects, the more comfortable you'll become with Visual Basic. If you have specific questions or encounter challenges, feel free to ask for help. Good luck with your programming journey!

Again so far so good. However for the beginner using the above information it is not enough to write any usefull code. So I asked myself the question: can ChatGPT help me in solving the Debug.Print problem. A problem that Microsoft can't solve (?).
So let me try with a small piece of code that shows this problem. See also: comment1

3.
Public Class ControlForm
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        TMesg1.Text = "Start"
        Debug.Print("Start")
        TMesg2.Text = "End"
        Exit Sub

It looks like you have the basic structure of a button click event in a Visual Basic form. Here are a few comments and suggestions for your code:
  1. Exit Sub:
    The Exit Sub statement is used to exit the current subroutine (in this case, the button click event). If you want the subroutine to exit at this point, you can keep it. Otherwise, you can remove it, and the execution will naturally reach the end of the subroutine.
  2. Debugging Output:
    The Debug.Print("Start") statement is useful for printing messages to the Output window in Visual Studio while debugging. It can be helpful for tracking the flow of your program. You may want to use Debug.Print for debugging purposes and comment it out or remove it in the final version.
  3. Updating Textboxes:
    It seems you are updating the text of two TextBox controls (TMesg1 and TMesg2). If these are TextBox controls on your form, this is the correct way to update their text properties. Here's an updated version with a minor adjustment: vb Copy code
    Public Class ControlForm
        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            ' Update the text of TMesg1 and TMesg2
            TMesg1.Text = "Start"
            Debug.Print("Start")
            TMesg2.Text = "End"
    
            ' Optionally, you can remove the Exit Sub if you want the subroutine to reach its end naturally.
            ' Exit Sub
        End Sub
    End Class
    
This code should work fine if you have TextBox controls named TMesg1 and TMesg2 on your form and you want to update their text properties when Button1 is clicked. If you have further questions or if there's anything specific you'd like to achieve, feel free to ask!

All of the above is correct, but this is not the problem I currently experience. Let me try to pinpoint to my problem. That is why I wrote:

4. The problem is with Visual Basic 2022 I don't see it the Debuging Output on my screen

If you're not seeing the Debugging Output in Visual Basic 2022, it might be due to a few reasons. Here are some steps you can take to troubleshoot and resolve the issue:
  1. Output Window Visibility: Ensure that the Output Window is visible. You can find it in Visual Studio by going to View > Output or using the shortcut Ctrl + Alt + O. This will open the Output Window, and you can select "Debug" from the drop-down menu to see the Debugging Output.
  2. Check Debug Configuration: Make sure that your project is configured for debugging. You can check this by going to Project > Properties > Compile > Advanced Compile Options, and ensure that "Generate debug info" is set to "Full."
    This is description for Visual Basic 2019
  3. Output Window Configuration: In the Output Window, there is a drop-down menu where you can select the type of output to display. Make sure "Debug" is selected.
  4. Use Console.WriteLine for Console Output: Alternatively, you can use Console.WriteLine for debugging output. If you're working on a Windows Forms application, the output will appear in the Visual Studio Output Window when running the application. vb Copy code
    Public Class ControlForm
        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            ' Update the text of TMesg1 and TMesg2
            TMesg1.Text = "Start"
            Console.WriteLine("Start")
            TMesg2.Text = "End"
        End Sub
    End Class
    
    Make sure the Output Window is selected to show "Program Output" or "Debug Output" to see the output from Console.WriteLine.
    This type of modifications are not my cup of cake. The solution should not involve program modifications.
    Any way I tried them both in Release 2019 and in Release 2022, but they did not show up See also: Comment1
  5. Check Breakpoints and Debugging Settings: Make sure you don't have breakpoints set that could be pausing the execution of your code. Check your debugging settings and ensure that everything is configured as expected.
If you've tried these steps and still encounter issues, it might be helpful to provide more details about your project configuration or any specific error messages you're seeing.
Is this conversation helpful so far?
My answer on this question was: Yes
Infact such a question can be very helpful, to give some feedback how the conversation is going.

5. In Visual Basic 2022 there is no "Generate debug info"
In Visual Basic 2019 the "Generate debug info" is set to portable

In Visual Basic (VB) projects within Visual Studio, starting with Visual Studio 2019 and later versions, the option "Generate debug info" has been replaced by the "Debug Information" dropdown. Instead of choosing between "Full" and "Portable," you now have options like "pdb-only" or "none" depending on your needs. Here's how you can find it in Visual Studio 2022:
Right-click on your project in the Solution Explorer.
Select "Properties" from the context menu.
In the project properties, navigate to the "Build" tab on the left.
Look for the "Debugging Information" dropdown under the "Advanced" section.
In Visual Studio 2022, you should see options like "Full," "pdb-only," and "none." For debugging purposes, you generally want to set it to "Full" or "pdb-only." The "pdb-only" option generates a separate .pdb (Program Database) file, which is useful for debugging without including unnecessary information in the main executable.

If you're still not seeing debug output in the Output window after setting the debugging information appropriately, make sure you're selecting the correct output pane in the Output window. You can select "Debug" from the dropdown in the Output window to view debug output.

If the issue persists, there might be additional factors involved, and it could be beneficial to seek assistance in Visual Studio forums or communities.
What you need is a Visual Basic forum. See also: Evaluation 2 - Microsoft versus ChatGPT support

6. Visual Basic 2019 has no problem. The Debug.Print statement output is Start

If you are experiencing a difference in behavior between Visual Basic 2019 and Visual Basic 2022 regarding the Debug.Print statement, and you are not seeing the output in the Output window in Visual Studio 2022, there might be some environmental or configuration differences. Here are a few additional steps you can take to troubleshoot the issue:
  1. Ensure Debug Configuration: Confirm that you are running your application in Debug mode. You can check this by looking at the toolbar in Visual Studio. There should be a dropdown that says "Debug" or "Release." Make sure it is set to "Debug."
  2. Explicitly Set Debug Output: If you are using Debug.Print statements and not seeing the output, you can try explicitly setting the output to the Debug window by using Debug.WriteLine: vb Copy code
    Debug.WriteLine("Start")
    
    This should output the message to the Debug window in Visual Studio when you run your application.
    This statement has the same problem as the Debug.Print ("Start") statement
  3. Check Immediate Window: You can also check the Immediate Window in Visual Studio (View > Other Windows > Immediate) while debugging. If you type ? "Start" and press Enter, it should print "Start" in the Immediate Window.
  4. Check Output Window Settings: Ensure that the Output window is configured to display Debug output. In the Output window, there is a dropdown menu where you can select the type of output to display. Make sure "Debug" is selected.
  5. Clean and Rebuild: Try cleaning and rebuilding your solution. Sometimes, issues can arise due to a stale build.
  6. Update Visual Studio: Ensure that you are using the latest version of Visual Studio. Check for updates and install any available updates.
  7. Restart Visual Studio: Sometimes, restarting Visual Studio can resolve unexpected behavior.
If the issue persists after trying these steps, it may be beneficial to seek help on Visual Studio forums or communities. You can provide more details about your project, configurations, and any error messages you encounter for more targeted assistance.
What ChatGPT does not know, that I already had a long discussion with Microsoft.
My next question was this discussion

7 Start of question # 7
  1. Problem with Visual Studio - Basic 2022 Debug.Print
    Reported Jul 15, 2023 4:26 PM - by nicolaas.vroom@pandora.be
    Under Consideration - 0 Votes - [severity:It's more difficult to complete my work]
    Problem with Debug.Print statement
    Since Thursday I have a problem with the Debug.Print statement.
    For information about this error select this link:
    https://learn.microsoft.com/en-us/visualstudio/ide/reference/print-command?view=vs-2022

    I'm debugging the Visual Basic program: VB2022 FindPrim QC.sln
    When you start this program via 'Debug' the 'Output' box shows:
    15:02:57:020 'VB2022 FindPrim QC.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\6.0.14\System.Linq.Expressions.dll'.
    15:03:15:337 The thread 0x13b0 has exited with code 0 (0x0).
    In between both lines I would expect outputs from the Debug.Print statement, but the space is empty

    The same I have done via Visual Basic program: VB2019 FindPrim QC.sln
    When you start this program via 'Debug' the 'Output' box shows:
    'VB2019 Findprim QC.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\5.0.17\System.Collections.NonGeneric.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    TestIpower 62 exp 4611686018427387904
    This is the output of a Debug.Print statement and that is correct.

    Before Thursday the VB2022 program worked 100% correct.
    I have never seem a similar problem with Quick Basic and Visual Basic 5.0
    Most probably I have changed something on the screen.
    May be, I have recently done a sort of system update. Please inform me how to check.
    Every advice is welcome
    Nicolaas Vroom.
    windows 10.0
    Visual Studio 2022 version 17.5.1

  2. Jul 15, 2023 4:26 PM by Feedback Bot Triaged
    We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.
  3. Jul 17, 2023 4:33 AM by Feedback Bot Under Consideration
    Thank you for sharing your feedback! Our teams prioritize action on product issues with broad customer impact.
    See details at: https://docs.microsoft.com/en-us/visualstudio/ide/report-a-problem?view=vs-2019#faq .
    In case you need answers to common questions or need assisted support, be sure to use https://visualstudio.microsoft.com/vs/support/. We'll keep you posted on any updates to this feedback.
  4. Jul 21, 2023 12:23 AM by Aria Zhu [MSFT]
    Need More Info
    Thank you for taking the time to log this issue! We are unable to reproduce this issue with the description in the latest stable version of Visual Studio. Did you still reproduce this issue in the latest stable version of Visual Studio installed from https://visualstudio.microsoft.com/downloads ? If so, could you please provide the reproduce steps and a sample solution that has this problem so that we can conduct further research? We look forward to hearing from you!
  5. Aug 04, 2023 10:57 AM by nicolaas.vroom@pandora.be
    For more detail about my problem select this link: https://nicvroom.be/VB2022 shor-findprim-QC.htm This gives info about the application. I have written two programs to demonstrate the problem:
    https://nicvroom.be/VB2022 Debug.Print.zip
    The files below apart of a program called VB2022 Debug.Print
    https://nicvroom.be/VB2019 Debug.Print.zip
    Both programs are 'identical'.
    In the debug mode program #2 shows the output of the Debug.Print statement. That is correct.
    In the debug mode program #1 does not show the output of the Debug.Print statement. That is wrong.
    What I don't understand is that it is possible to give feedback only related to VB2022 issues, nor to communicate only with VB2202 users. I'm not interested to all microsoft problems i.e. Visual Studio. What I only need is info strictly for VB2022 issues. What I specific want to know if other users have the same problem.
    If you want we can try to communicate via IPhone.
    Nicolaas Vroom Belgium
  6. Aug 08, 2023 5:26 PM BY Aria Zhu [MSFT]
    Thank you for your feedback, according to the effective information you provide, we will submit this issue to our developers, please wait patiently, we will continue to track this problem and feedback to you in time.
  7. Aug 09, 2023 11:43 AM By Aria Zhu [MSFT] Under Consideration
    Thank you for your feedback, according to the effective information you provide, we will submit this issue to our developers, please wait patiently, we will continue to track this problem and feedback to you in time.
  8. Aug 09, 2023 12:43 PM
    by nicolaas.vroom@pandora.be A similar problem was also discussed in the following forum: https://www.vbforums.com/showthread.php?834091-RESOLVED-Debug-Print-not-showing-in-Immediate-window
    The problem is the solution is related to an older issue VS 2010.
  9. Aug 30, 2023 10:20 PM
    By Feedback Bot
    I detected that this issue hasn't received a lot of activity, votes, or comments in the past 90 days. Based on this, the issues severity and affected area, it's my experience that this issue is unlikely to get fixed. To improve the situation, consider following best practices for quality problem reports, and giving us more details on how this issue is impacting you.
    My interpretation is that Microsoft stops to solve this problem. For more information see: Evaluation 2 - Microsoft versus ChatGPT support
    To read the whole document select: https://developercommunity.visualstudio.com/t/Problem-with-Visual-Studio---Basic-2022-/10416147#T-ND10506271

End of question #7

It seems that you've encountered an issue with the Debug.Print statement in Visual Studio 2022, and you've reported it to Microsoft. They are currently under consideration and investigating the problem. While waiting for an official resolution, you might consider some workarounds or alternative approaches:
  1. Console Output: Instead of relying solely on Debug.Print, you can also use Console.WriteLine for debugging output. The output will be visible in the console window if you are running the application in console mode. vb Copy code
    Console.WriteLine("Start")
    "comment1" I was not able to test this statement neither with VB2019 or with VB2022
  2. Logging Framework: Integrate a logging framework into your application, such as Serilog or NLog. This provides a more flexible and configurable way to handle logging, and you can redirect logs to various outputs, including files.
  3. MessageBox for Debugging: If you are working on a Windows Forms application, you can use MessageBox.Show to display debugging information in a message box.
    vb Copy code
    MessageBox.Show("Start")
    This 'solution' works, but can't be used as a general solution
  4. Check for Updates: Periodically check for updates to Visual Studio. Microsoft releases updates and patches that may address issues reported by users.
  5. Community Forums: Explore community forums and discussions related to Visual Studio 2022. Other developers may have encountered similar issues and could provide insights or workarounds.
It's unfortunate that you're experiencing this issue, and I hope Microsoft addresses it soon. If you have specific questions or need further assistance, feel free to ask.

8 As I wrote, my 3 lines program using VB2019 works perfect, using VB2022 the Debug.Print statement does not work. The only solution is to forget VB2022.

I understand the frustration you're experiencing with the issue in Visual Studio 2022. It's unfortunate when such problems arise, and it can be challenging when a tool you rely on doesn't behave as expected. If the Debug.Print issue is a critical factor for your work, and it's not resolved in a satisfactory manner, you may indeed consider sticking with Visual Studio 2019 or exploring alternative IDEs.

Before making a decision, you might want to check for updates to Visual Studio 2022, as Microsoft frequently releases updates and patches. It's possible that a future update may address the issue you're facing. Additionally, you can stay connected with the Visual Studio community forums or Microsoft support channels for updates and possible workarounds.

If you have specific functionality or reasons that require the use of Visual Studio 2022, you may need to weigh the pros and cons based on your project's requirements. Keep an eye on updates and community discussions, and hopefully, a resolution will be provided in the near future.

If you have further questions or need assistance with any specific aspects of your code or project, feel free to share more details, and I'll do my best to help.

9 The problem is that this is a MicroSoft issue.

Indeed, if the issue is related to the behavior of Debug.Print in Visual Studio 2022 and seems to be a bug or unexpected behavior, it falls under Microsoft's responsibility to address and fix it. It's not uncommon for issues to arise with software updates, and Microsoft typically works to resolve such problems through updates and patches.

You've already reported the issue through the appropriate channels, and Microsoft has acknowledged it. While waiting for an official fix, you may need to consider alternative approaches for debugging, such as using Console.WriteLine, incorporating a logging framework, or exploring other debugging techniques.

If you have specific deadlines or requirements for your projects, you might also consider reaching out to Microsoft Support or the Visual Studio support channels for additional assistance and information on potential workarounds.

I appreciate your understanding in this situation, and I hope that Microsoft addresses the issue promptly. If you have any other questions or if there's anything else I can assist you with, feel free to let me know.

10. The problem is I have already updated one program to modify all debug.print statement to a message.text statement, but that is a horrible exercise.

I understand that updating all Debug.Print statements to use MessageBox or another mechanism can be a time-consuming and tedious task, especially in a larger codebase. It's unfortunate that you had to resort to such a workaround due to the issue with Debug.Print in Visual Studio 2022.

While waiting for Microsoft to address and fix the problem, here are a couple of suggestions that might make the transition a bit smoother:

  1. Search and Replace: Use the search and replace functionality of your code editor to automate the process of replacing Debug.Print with your chosen alternative (e.g., MessageBox or Message.Text). This can be more efficient than manually modifying each occurrence.
  2. Conditional Compilation: If you want to preserve the use of Debug.Print for future compatibility, you can consider using conditional compilation directives. This way, you can easily switch between the original Debug.Print and the temporary workaround based on the Visual Studio version.
vb
Copy code
#If DEBUG Then
    Debug.Print("Your debug message")
#End If
This ensures that Debug.Print statements are only included in the code when the project is built in Debug mode.

I understand that these suggestions might not fully alleviate the inconvenience, but they could help streamline the process and make it more manageable. Hopefully, Microsoft will address the issue in an upcoming update, and you'll be able to revert to using Debug.Print as intended. If you have further questions or need more assistance, feel free to ask.

11. My use for Visual Basic is specific to write parallel programming. I use 4 processors and this works perfect. I have to buy a new PC to install windows 11 and Visual Studio 2022, but I have no guarantee that it works.

If your primary use for Visual Basic involves parallel programming and you rely on specific features or behaviors that are currently affected by the issue in Visual Studio 2022, it's understandable that you might have concerns about transitioning to a new PC with Windows 11 and the latest Visual Studio version.
Here are a few steps you can consider to mitigate risks and make an informed decision:
  1. Test on a Secondary Machine: Before purchasing a new PC, if possible, you might want to test your Visual Basic project on a secondary machine that already has Windows 11 and Visual Studio 2022 installed. This can help you evaluate how your specific codebase behaves in the new environment.
  2. Check for Updates: Ensure that you are using the latest updates for both Windows 11 and Visual Studio 2022. Microsoft frequently releases updates to address issues and improve compatibility.
  3. Community Feedback: Monitor Visual Studio forums, community discussions, or any official Microsoft announcements regarding updates or patches for Visual Studio 2022. Feedback from other developers who have similar requirements can provide insights into the current state of the platform.
  4. Parallel Programming Libraries: If your parallel programming heavily relies on specific libraries or frameworks, make sure those are compatible with the latest versions of Visual Studio and Windows 11.
  5. Compatibility Mode: Windows 11 includes compatibility modes that can be used to run applications designed for older versions of Windows. You can explore these settings to ensure that your applications work smoothly.
  6. Contact Microsoft Support: If you have specific concerns or questions about compatibility, consider reaching out to Microsoft Support. They may be able to provide guidance based on your unique scenario.
  7. Backup and Rollback Plan: Before migrating to a new PC, ensure that you have a backup of your project and a rollback plan in case you encounter unexpected issues. This can include creating disk images, version control backups, or other methods to revert to a stable state if needed.
Taking these steps should help you make a more informed decision when transitioning to a new PC with Windows 11 and Visual Studio 2022. While there are potential challenges, staying informed and being proactive can help minimize risks. If you have any specific questions or need further assistance, feel free to ask.
The final program discussed, with all the options, looks like this:

Public Class ControlForm
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        TMesg1.Text = "Start"
        Debug.Print("Start")
	Debug.WriteLine("Start")	
	Console.WriteLine("Start")
	MessageBox.Show("Start")
        TMesg2.Text = "End"
        Exit Sub
And that is a very impresive result in such a short discussion with ChatGPT.


Reflection 1 - ChatGPT - Introduction discussion

The purpose of this discussion is to understand the difference between software support by Microsoft versus the support by ChatGPT
The problem discussed is with the Debug.Print statement.
In order to understand the problem we use 3 concepts: Operator Display, Debug Display and a Visual Basic Program
                           ---------
      -------        a =  |    4    |              -------
     | START |             ---------     result = |   9   |
      -------        b =  |    5    |              -------
                           ---------

                   Operator Display
1.     a = a.Text
2.     b = b.Text
3.     result = a+b
4.     result.Text = result
5.     Debug.Print "result " + result.Text

         Visual Basic Program

Operator Display

The Operator display contains 3 global parameters: a,b and result.
The parameters a and b are input parameters and can de set by an operator.
The parameters result shows the result of the program.
The Operator display contains 1 button: Start
When the Start button is selected the Visual Basic program is executed

Visual Basic program

The program contains 3 local variables: a,b and result.
In the lines 1 and 2 the global parameters a and b are copied in the local variables a and b
Line 3 shows the algorithm of the program
Line 4 shows that the local variable result is copied to the global parameter.
Line 5 shows the debug.print statement. This statement is supposed to copy local variable result to the Debug Display. However this does not happen.
Of Visual Studio and also of Visual Basic there are 2 releases. One is called Visual Basic 2019 and one Visual Basic 2022. And the problem is with Visual Basic 2022. Using Visual Studio 2019 the Debug.Print statement still works. Using Visual Studio 2022 roughly around 15 July 2023 I discovered that the Debug.Print statement did not work any longer. This is a horrible discovery if you want to test or debug your program
If such a problem arises, the first question you have: did I do something wrong? Untill to day I don't know the answer.


Reflection 2 - Evaluation Microsoft versus ChatGPT support

When you read above discussion, the ChatGPT support to help me with my Debug.Print problem was very helpfull.
If this looks a game it is 10 points for ChatGPT and 0 points for Microsoft.
At least ChatGPT gives you an idea that 'someone' is doing an effort to help me. With Microsoft that is not the case.
However and that is the sad part, ChatGPT can't ready help me, because it is a Microsoft problem related to release Visual Basic 2022, and not a Visual Basic 2019 issue. In principle it can also be Visual Studio 2022 issue.

Part of the problem is Visual Studio. IMO this is what I call the umbrella under which Visual Basic runs, but from an operating point of view, has nothing to do with Visual Basic. You get an idea of this mismatch when you select Help I get this link: https://learn.microsoft.com/en-us/visualstudio/ide/not-in-toc/welcome-to-visual-studio-docs?view=vs-2022 Which starts with "Welcome to the Visual Studio Docs". What you get is, I expect, a lot of valuable information, but that is not what a Visual Basic user wants. She or he wants specific data for Visual Basic and not for C#, F# , C++ or AI.

The following document has the same problem: https://learn.microsoft.com/nl-nl/visualstudio/ide/how-to-report-a-problem-with-visual-studio?view=vs-2022


Reflection 3 - Microsoft versus ChatGPT support part 2

In the previous reflection I wrote: If this looks a game it is 10 points for ChatGPT and 0 points for Microsoft.
ChatGPT tries to help me, based on my questions and its own knowledge. This help comes from workarounds, but not from fixing the problem. Observing the workarounds tries to do his best. A different type of help is required for all the parameters inside Visual Basic. The problem is that these parameters and there settings are not the same for Visual Basic 2019 and Visual Basic 2022. To understand these parameters, the setting of each, their importance and to evalute the consequences is difficult for a human being and even more for a 'robot'. That there are mistakes made, can be as expected.
My understanding is that ChatGPT can help me with Visual Basic Applications problems but not with system problems. That is the task of Microsoft.

Suppose that ChatGPT gets a copy of all the manuals that Microsoft has, will it than perform better?

  • Yes, I expect for application dependent problems.
    I used in the past the book: Microsoft Quick Basic Compiler, to manage all my projects. In that book all the statements are explained, included with practical examples. With Visual Basic 6 that same type of information was included as part of the program. In Visual Basic 2022 it does not exist.
  • No, I expect for system related issues.
    To solve these problems you have to modify the system source.
    ChatGPT will be of little help in that respect, even if you supply ChatGPT with the program listings. It is finally microsoft which has to fix the issue.
Maybe some day, Microsoft comes with the fix that I have to remove Visual Studio 2022 completly and reinstall it again, based on their experience. Lets wait and see.

All of that changes the outcome of the game to: It is 7 points for ChatGPT and 3 points for Microsoft.


Reflection 4 - How do you write a computer program that is intelligent

In my discussion with ChatGPT we shortly discussed the subject: How to manage a software project.
The most important of every software project, specific if you want to write software for a client, is detailed documentation, including an operation manual, a description of the mathematics and logic behind the program, a description of the input and of the output.
All of that has to read and commented by the client before the project can start.
However to write a software program that is considered intelligent is something more. This intelligence is part of algorithm of the program. The algorithm is all what is involved (all the calculations and decisions) to calculate the output of the program. Such a program is supposed to learn every time when the program is executed and slowly to become more intelligent. Learning means that the algorithm is modifies itself.
There are two ways to learn
  • In an analoque or continues way
  • In a discrete way or in steps.
The best examples of analoque ways are in the process control industry. Starting point are a model of the process studied. A model is a set of equations between variables. The equations describe how each variable changes as a function of the other variable. The equations include parameters. These parameters are specific used to describe the inter-relations between the different variables. To calculate these parameters is part of the learning process. It is important that as part of the learning process the equations don't change. My understanding is, that deep learning also falls in this cathegory.

Discrete learning can be used to develop games. There are two ways to implement learning.

  • By a programming team who modifies the program based on the results of the matches played. The intelligence of the final solution is the intelligence of the programming team.
  • It is supposed to understand the output of the program written text and to give an intelligent anwer. All of that should be encapsulated in a computer program, in mathematics.
    Suppose the purpose of the AI program is to write a program which creates a maze or a game.
    • The first step of that exercise is to describe a detailed description of what a maze is or the rules of the game.
    • The second step is that the AI program reads this description line by line and generates the statements of the program written in a certain software language.
    • The third step is that the program is executed and performs its purpose. That means the user can solve the maze or play the game, consisting of moves, against a player or against the computer.
    The most difficult part is step 2 to create a software program based on a detailed description of the purpose. However that is not the most difficult problem to solve, the program should also be intelligent. That means the program should also learn from the results how the program performs. In the case of the maze this is difficult to measure but not in case of a game where the results of each game of the computer versus each player can be ranked, saved and compared. Saving in this case has to be understood as information about lost games which moves should not be repeated, in order to improve the winning results of the computer. As already mentioned, this learning capability is the most complex task, and should be based on actual played games during a certain tournament.

    Testing

    What is not mentioned is testing the AI created software program. One of the most interesting examples, is the fully automatic driving car. In this case a car, which only requires the coordinates on a map and a start button to bring you to this destination, after which, under all circumstances, you can close your eyes for the whole trip. The only problem is, suppose all the cars are like that, when there is an accident who is to blame? The only reasonable answer is, the developpers of both cars, assuming it is requiered to have a black box in both cars.


Reflection 5 - How do you write a computer program that plays checkers

In order to write any program you need a detailled description of the program. In the case of a game of checkers you need the rules of checkers.
Following are the rules of the game of checkers:
  1. Checkers is played with 2 players.
  2. Checkers consists of a board of 10 by 10 squares.
  3. All fields are colored black or white.
  4. The first (bottom) row of the fields have the colors black, white, black, white, etc. from left to right.
  5. In the second row the fields have the colors white, black, white, black, etc. from left to right.
  6. Rows three, five, seven and nine have the same colors as row one.
  7. Rows four, six, eight and ten have the same colors as row two.
  8. One player has 20 white pieces and the other has 20 black pieces.
  9. The player with the white pieces places his 20 pieces on the 20 black squares of rows one, two, three and four.
  10. The player with the black pieces places his 20 pieces on the 20 black squares of rows seven, eight, nine and ten.
  11. That is to say, there are no pieces on rows 5 and 6.
  12. The player with white starts.
  13. The player with white can place a piece diagonally up left or diagonally up right, if that square is empty.
  14. The player with white can also capture a black piece.
  15. This is possible if there is a black piece in any diagonal direction and the next square in that same direction is free.
  16. The white player then places his piece on the free square and removes the black piece.
  17. The player with white can then repeat this as long as possible,
  18. Then it is the turn of the player with the black pieces.
  19. The player with black can place a piece diagonally down to the left or diagonally down to the right, if that square is empty.
  20. The player with black can capture a white piece in the same way.
  21. Then it is the turn of the player with the white pieces again and continues at point 13.
  22. A player wins as soon as the other player has no more pieces.
  23. Comments:
    1. Each player has 2 operating modes: Manual or Automatic.
    2. When the player is in Automatic mode, it is the computer who decides the next move.
    3. When a player is Automatic mode, the computer has to make his moves accordingly to the rules.
    4. When a player is Automatic mode, the computer, initially, in the first game against each new player, has to start with random moves.
Following are the conceptual steps of the AI program:
1. Learn the programming language Visual Basic.
2. Create a New project Checkers_AI which has one Form.
A Form is the name of the display that shows the lay out of the checkers board and that allows two players to play the game.
The Form should also use a button called "Start", which is your interface to the actual "AI program". 3. Pressing the "Start" button should allow the "AI program" now to:
4. Read the rules of the game line by line
4.1 Read the comments of the game line by line
5. For each line:
5.1 Define the parameters, and store them in a text file.
There are two types of parameters:
5.1.1 Parameters displayed on the Form.
5.1.2 Internal parameters as part of the program.
5.2 Define the programming lines and store each also in a text file.
6. When all the rules are read and processed in principle the program is ready.
But that is an oversight, now the most biggest problem starts: Error processing.


Reflection 5.1 - Error processing

There are are two types of Errors:
  • Errors related to the rules of the game and the man machine interface of the "AI program".
  • Software errors in the "AI program" and structural errors in the "AI program".

Reflection 5.1.1 - Errors related to the rules of the game and the man machine interface of the "AI program"

The errors are within the rules are:
  1. Are all the rules clear? Most probably that is not the case, however when that is not the case they have to be corrected and completed.
  2. The second problem is which the man machine interface:
    Most probably, when they are included, they are not complete.
  3. The third problem is: suppose one player is the computer, which move does the computer play? The answer is simple: The move must be completely random and accordingly to the rules.

Reflection 5.1.2 - Errors within the AI program

The first type of errors are sofware errors in the AI program When there are errors in the AI program, the AI program has to modified. That means the player, after an error has occured, immediate has to inform the AI program that something went wrong. In short the player has to write a piece of text, which describes the problem.
That means that the AI program next, has to read this text line and modify the AI program. As a result the same game has to be repeated.
When the problem is not solved, the text with the problem definition has to be modified.
See also the Reflection 5.2


Reflection 5.2 - Will it be possible to write this AI program

My expectation to write a program which output is an AI program based on a description of that program is extremely difficult.
What is possible that you first write a program A that performs a certain task.
The second step is to create a file B which only contains specific parameters.
The third step is to write a program that writes a program C based on program A and modified with the parameters in file B.

In general this solution is not very helpfull. What makes sense to write direct a program which plays chess accordingly to the rules.


Reflection 5.3 - Intermezzo - Creating new knowledge.

Right now, when you play chess against a computer, you are playing against a program that is man-made. Writing such a program is not difficult, if it involves two players. E.g. for the game tic tac toe. See: https://en.wikipedia.org/wiki/Tic-tac-toe The hardest part of such a program is that the players must adhere to the rules.
It becomes much more difficult when one of the players is the computer. In this case, the program can also have a learning capacity. In the simplest case, this means that the program will no longer make those moves that will certainly lead to a loss.
It becomes even more interesting if the program itself adjusts its strategy based on the games played. In a game program, a program consists of a number of (program) lines of text that partly relate to the rules of the game and also lines of text that determine which move the computer must make. If we want the program itself to adjust its strategy, this involves additional (program) lines of text that adjust the way the program determines what the next move should be. You are, as it is called, rewriting part of the program. It is extremely difficult to have a program do this itself. I'm afraid impossible.

Please note, this is very different from adjusting the program based on the results.
This process is also difficult for humans. You first have to know exactly how the program works.

 1       A = 10, B = 70, C = 100
 2       Max = A
 3       IF B > Max  then Max = B      
 4       IF C > Max  then Max = C
 5       Debug.Print  "Maximum "; Max
 6       End 
'        Programma 1
1       N(1) = 10, N(2) = 70, N(3) = 100
2       Max = N(1)
3	For i = 2 to 3
4       	IF N(i) > Max then Max = N(i)   
5       Next i  
6   	Debug.Print  "Maximum "; Max
7       End 
'       Programma 2
Above are two programs. Program 1 is the original program written by a human. Program 2 is written by 'ChatGPT' or something similar.
The bottom line is if you want to do this conversion you must first understand Program 1.
If you look at lines 3 and 4 together, the function is: calculate the maximum of two numbers.
If you want to do it a little more accurately: Calculate the maximum 'Max' of the two numbers 'A' and 'B'.
If you look at lines 3 to 5 together, the function is: calculate the maximum of three numbers. That's what it's about.

That is also the function of program 2: calculate the maximum of three numbers. Only now each of those three numbers does not each have its own name A B and C, but they are in a row with the name 'N'. To represent each individual number we use the variable 'i'.
If you look at line 4 you can see that that line is executed twice, for i = 2 and for i = 3. That is, first for N(2) and then for N(3). These are lines 3 and 4 in program 1 (written slightly differently)

What is most important, and that is what matters, is that the AI ​​program has rewritten the original text with the same functionality. In other words, the algorithm has remained exactly the same. The point is that the AI ​​program should write a smarter program, a better algorithm.
If you look at this link: https://en.wikipedia.org/wiki/Prime_number#History then you can you can read that there are two algorithms to calculate prime numbers: The sieve method or Fermat's theorem.
This means that program 1 uses the sieve method and that the AI ​​program uses this as a basis, devises and uses Fermat's theorem itself, i.e. the program creates new knowledge. Whether this is really possible is a question mark for me, but it's the idea that counts.


Reflection 6 - How do you write a computer program that plays checkers in an intelligent way.

The result of Reflection 5.1 that you have a program that plays chess but it does not include any form of intelligence.
However, now you have a program that can be tested, being the designer, to see how it performs. However, you are not allowed to modify the program based on that experience. When you modify the program, the next program becomes better but that program does not become more intelligent compared with the previous version. For the program to become more intelligent, the program should 'modify itself' based on the results of the games played, however that is not easy.

To get an idea read this document: https://eu.usatoday.com/story/graphics/2023/01/23/how-to-play-checkers-rules-strategy/10795787002/ This document contains a section called
Strategies for checkers which contains the sections:

1. Guard your side:
2. Sacrifice a checker:
3. Control the center:
4. Keep your pieces together:
5. Win by blocking:
However, all that information cannot be used, because then you are doing plagiarism.


Reflection 6.1 - Program VB2019 Checkers

The purpose of this program is to demonstrate, that it is impossible to generate, by an AI program (written in Visual Basic) a VB program which can play checkers and while doing that will improve, autark, its playing strategy. The program VB 2019 Checkers is an example of this VB program, except that it is not generated by an AI program.
To get the executable of this program select this link: VB2019 Checkers.zip


Reflection 6.2 - Program VB2019 Checkers Description and Operation.

Select this link: VB2019 Checkers operation


Feedback

None


Created: 10 December 2023

Back to my home page Index